//? 完全背包 -先背包 -解决排列问题
for (let j = 0; j <= target; j ++) {
    for (let i = 0; i < nums.length; i ++) {
        if (j - nums[i] >= 0) {
            dp[j] = dp[j - nums[i]] + dp[j]
        }
    }
}
//? 完全背包 -先物品 -解决组合问题
for (let i = 0; i < coins.length; i ++) {
    for (let j = coins[i]; j <= amount; j ++) {
        dp[j] = dp[j - coins[i]] + dp[j]
    }
}

//? 一维01背包
for (let i = 0; i < stones.length; i++) {
    for (let j = bagSize; j >= stones[i]; j--) {
        dp[j] = Math.max(dp[j], dp[j - stones[i]] + stones[i])
    }
}
